-- ********************************************
-- * Copyright (c) 2012 TPV R&D Center Brazil *
-- * All Rights Reserved                      *
-- ********************************************

--- toolkit.component.Rectangle

local Rectangle = Box:new()

function Rectangle:new(o)
   if(type(o) ~= 'table') then
      o = {}
   end

   local newRect = Box:new(o)
   
   newRect.parent = nil

   newRect.componentType = "Rectangle"

   newRect.borderColor = o.borderColor or nil
   newRect.borderWidth = o.borderWidth or 2

   --generate an object
   setmetatable(newRect, self)
   self.__index = self

   return newRect
end

function Rectangle:setColor(o)
   if(type(o) ~= "table") then
      o = {0, 0, 0, 0}
   end

   self.color = o

end

function Rectangle:setBorderColor(o)
   if(type(o) ~= "table") then
      o = {0, 0, 0, 0}
   end

   self.borderColor = o

end

function Rectangle:redraw()
   self.parent:update(self)
end

return Rectangle
